package org.flycloud.web.platform.util;

import java.util.Date;

import org.springframework.data.domain.Sort;

public class CommonSelectCommand {

	private Sort st;
	/**
	 * 开始日期（包括本日）
	 */
	private Date startDate;
	/**
	 * 结束日期（包括本日）
	 */
	private Date endDate;
	/**
	 * 当前浏览的页数
	 */
	private Integer page;
	/**
	 * 每页多少条
	 */
	private Integer limit;
	/**
	 * Extjs的排序參數
	 */
	private String sort;
	/**
	 * 录入人员的id
	 */
	private Long userid;

	public CommonSelectCommand() {
		super();
	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getLimit() {
		return limit;
	}

	public void setLimit(Integer limit) {
		this.limit = limit;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getSort() {
		return sort;
	}

	public void setSort(String sort1) {
		if (sort1 == null || sort1.equals("")) {
			return;
		}
		this.sort = sort1.replaceAll(
				"\\[\\{\"property\":\"|\",\"direction\":\"|\"\\}\\]", " ").trim();
		Sort.Direction dir = Sort.Direction.DESC;
		if (this.sort.endsWith("ASC")) {
			dir = Sort.Direction.ASC;
		}
		st = new Sort(dir, this.sort.replaceAll(" ASC| DESC", ""));
	}

	public Sort getSortObject() {
		return st;
	}

	public Long getUserid() {
		return userid;
	}

	public void setUserid(Long userid) {
		this.userid = userid;
	}

}